<h1>Voter Ballot</h1>

<h3>{{voter.election.title}}</h3>
<p>{{election.subtitle}}</p>
<p>{{voter.election.info}}</p>

<p>Your key B is {{voter.key_b}}

{% ifequal voter.election.state 'OPEN' %}

{% if voter.voted %}
<p>You have voted.  You can still change your vote until the election closes.
{% else %}
<p>You have not voted yet.  Please enter your ballot in the form below.
{% endif %}

<form method="POST" action="/vote">
<input type="hidden" name="b" value="{{voter.key_b}}">
<textarea cols=60 rows=12 name="ballot">{% firstof voter.ballot '' %}</textarea>
<br><input type="submit" value="Vote">
</form>

{% else %}

{% ifequal voter.election.state 'CLOSED' %}

<p>The election is closed.

{% if voter.voted %}
<p>Your vote is final.  Your ballot is: {{voter.ballot}}
{% else %}
<p>You have not voted.  Too bad.
{% endif %}

{% else %}

<p>The election is not yet open for voting.  Please come back later.

{% endifequal %}

{% endifequal %}

<p>Once the election is over, you can view the results at
<a href="{{host_url}}/ballots?id={{voter.election.key.id}}"
>{{host_url}}/ballots?id={{voter.election.key.id}}</a>. (Save this URL!)
